package com.miyi.utils;

public class Tools {
	
	public static boolean isNumeric(Object obj){  
		  String str = String.valueOf(obj);
		  for (int i = str.length();--i>=0;){    
		   if (!Character.isDigit(str.charAt(i))){  
		    return false;  
		   }  
		  }  
		  return true;  
		}
	
	public static boolean isEmpty(String s){
		if(s==null||"".equals(s.trim())){
			return true;
		}
		return false;
	}
	
	public static boolean isNotEmpty(Object obj){
		String str = String.valueOf(obj);
		return !isEmpty(str);
	}
	
	
	public final static boolean isNumeric(String s) {  
		return isRegexMatch(s,"^[0-9]*$");
    }
	
	public final static boolean isRegexMatch(Object obj,String re) {  
		return isRegexMatch(String.valueOf(obj), re);
	}
	
	public final static boolean isRegexMatch(String s,String re) {  
        if (s != null && !"".equals(s.trim()))  
            return s.matches(re);  
        else  
            return false;  
    }
	
}
